//
//  SelectTableViewCell.m
//  星期6
//
//  Created by 宗镇荣 on 16/2/23.
//  Copyright © 2016年 zzr. All rights reserved.
//

#import "SelectTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation SelectTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setUp];
    }
    return self;
}

- (void)setModel:(SelectModel *)model {

    [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url]];
    self.titleLabel.text = model.title;
    //self.countLabel.text = [NSString stringWithFormat:@"%@", model.likes_count];
}

- (void)setUp {

    self.selectionStyle = UITableViewCellAccessoryNone;
    self.contentView.backgroundColor = [UIColor whiteColor];
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(15, 3, [UIScreen mainScreen].bounds.size.width - 28, ([UIScreen mainScreen].bounds.size.width - 50)*0.6)];
    view.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:view];
    view.clipsToBounds = YES;
    view.layer.cornerRadius = 4;
    self.coverImageView = [[UIImageView alloc] initWithFrame:view.bounds];
    
    self.coverImageView.contentMode = UIViewContentModeScaleAspectFit;
    [view addSubview:self.coverImageView];
    
   // UIImageView *coverimage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"detailbg"]];
   // coverimage.frame = CGRectMake(0, self.coverImageView.bounds.size.height-60, self.coverImageView.bounds.size.width, 60);
    //[view addSubview:coverimage];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, self.coverImageView.bounds.size.height - 40, 270, 21)];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.font = [UIFont systemFontOfSize:20];
    [view addSubview:self.titleLabel];
    
    self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.coverImageView.bounds.size.width - 40, 40, 30, 21)];
    [view addSubview:self.countLabel];
    self.countLabel.font = [UIFont systemFontOfSize:15];
    self.countLabel.textColor = [UIColor whiteColor];
    
}

- (void)fillDataWithDict:(NSDictionary *)dic {

    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
